import 'package:flutter/material.dart';

class NotificationScreen extends StatelessWidget {
  const NotificationScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: const Color(0xFFF8F9FA),
      appBar: AppBar(
        title: const Text('消息通知'),
        backgroundColor: Colors.white,
        foregroundColor: const Color(0xFF333333),
        elevation: 0,
        leading: IconButton(
          icon: const Icon(Icons.arrow_back_ios, size: 16),
          onPressed: () {
            Navigator.pop(context);
          },
        ),
        actions: [
          TextButton(
            onPressed: () {
              // 标记全部已读
            },
            child: const Text(
              '全部已读',
              style: TextStyle(
                color: Color(0xFF1890FF),
                fontSize: 14,
              ),
            ),
          ),
        ],
      ),
      body: ListView(
        padding: const EdgeInsets.all(16),
        children: [
          _buildNotificationItem(
            title: '系统通知',
            content: '您的实名认证已通过审核',
            time: '2024-01-15 14:30',
            isRead: false,
            icon: Icons.verified_user,
            iconColor: const Color(0xFF52C41A),
          ),
          const SizedBox(height: 12),
          _buildNotificationItem(
            title: '交易提醒',
            content: '您的NFT "青花瓷·梅兰竹菊" 有新的出价',
            time: '2024-01-15 10:20',
            isRead: false,
            icon: Icons.monetization_on,
            iconColor: const Color(0xFFFAAD14),
          ),
          const SizedBox(height: 12),
          _buildNotificationItem(
            title: '活动通知',
            content: '非遗文化节即将开始，快来参与吧！',
            time: '2024-01-14 16:45',
            isRead: true,
            icon: Icons.event,
            iconColor: const Color(0xFF1890FF),
          ),
          const SizedBox(height: 12),
          _buildNotificationItem(
            title: '收藏提醒',
            content: '您关注的艺术家发布了新作品',
            time: '2024-01-14 09:15',
            isRead: true,
            icon: Icons.favorite,
            iconColor: const Color(0xFFF5222D),
          ),
          const SizedBox(height: 12),
          _buildNotificationItem(
            title: '安全提醒',
            content: '检测到您的账户在新设备上登录',
            time: '2024-01-13 20:30',
            isRead: true,
            icon: Icons.security,
            iconColor: const Color(0xFF722ED1),
          ),
        ],
      ),
    );
  }

  Widget _buildNotificationItem({
    required String title,
    required String content,
    required String time,
    required bool isRead,
    required IconData icon,
    required Color iconColor,
  }) {
    return Container(
      padding: const EdgeInsets.all(16),
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(12),
        boxShadow: const [
          BoxShadow(
            color: Color(0x1A000000),
            blurRadius: 8,
            offset: Offset(0, 2),
          ),
        ],
      ),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          // 图标
          Container(
            width: 40,
            height: 40,
            decoration: BoxDecoration(
              color: iconColor.withOpacity(0.1),
              borderRadius: BorderRadius.circular(20),
            ),
            child: Icon(
              icon,
              color: iconColor,
              size: 20,
            ),
          ),
          const SizedBox(width: 12),
          // 内容
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Row(
                  children: [
                    Text(
                      title,
                      style: TextStyle(
                        fontSize: 16,
                        fontWeight: FontWeight.bold,
                        color: isRead ? const Color(0xFF666666) : const Color(0xFF333333),
                      ),
                    ),
                    const Spacer(),
                    if (!isRead)
                      Container(
                        width: 8,
                        height: 8,
                        decoration: BoxDecoration(
                          color: const Color(0xFFF5222D),
                          borderRadius: BorderRadius.circular(4),
                        ),
                      ),
                  ],
                ),
                const SizedBox(height: 4),
                Text(
                  content,
                  style: TextStyle(
                    fontSize: 14,
                    color: isRead ? const Color(0xFF999999) : const Color(0xFF666666),
                    height: 1.4,
                  ),
                ),
                const SizedBox(height: 8),
                Text(
                  time,
                  style: const TextStyle(
                    fontSize: 12,
                    color: Color(0xFF999999),
                  ),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}